package com.newegg.datafeed.adserving.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.newegg.datafeed.adserving.domain.Channel;

@Mapper
public interface ChannelMapper {

	@Select("SELECT id,name,disable,memo FROM channel")
	List<Channel> getAll();
	
	@Insert("INSERT INTO channel(id,name,disable,memo) VALUES (#{id},#{name},#{disable},#{memo});")
    void insert(Channel channel);
	
	@Update("UPDATE channel SET name=#{name},disable=#{disable},memo=#{memo} WHERE id =#{id}")
    void update(Channel channel);
	
	@Delete("DELETE FROM channel WHERE id=#{id}")
    void delete(String id);

	@Select("SELECT id FROM channel")
	List<String> allKeys();

	@Select("SELECT id,name,disable,memo FROM channel where id=#{id}")
	Channel get(@Param("id") String id);
}
